<%@page contentType="text/html; charset=utf-8" language="java" import="java.util.*,com.pub.tools.*"%>
<%@page import="com.pub.database.*"%>
<jsp:useBean id="webFunction" scope="request" class="com.pub.web.WebFunction"/>
<!-- 以下為DataView 共用設定 -->
<jsp:useBean id="DataViewForm" scope="request" class="com.pub.database.DataViewForm"/>
<jsp:setProperty name="DataViewForm" property="submitMethod" value="POST"/>
<jsp:setProperty name="DataViewForm" property="pageRowCount" value="100"/>
<jsp:setProperty name="DataViewForm" property="nowPageNum"/>
<jsp:setProperty name="DataViewForm" property="dataViewAction"/>
<jsp:setProperty name="DataViewForm" property="filterCol"/>
<jsp:setProperty name="DataViewForm" property="filterValue"/>
<jsp:setProperty name="DataViewForm" property="dvOrderByFields"/>
<jsp:setProperty name="DataViewForm" property="dvOrderBySeq"/>
<!-- DataView 設定結束 -->
<%
  webFunction.setPortal_to_session(request); //set session from portal
  if (session.getAttribute("u_id") == null) {
    session.setAttribute("path", String.valueOf(request.getRequestURI()));
    session.setAttribute("param", null);
    response.sendRedirect("login.jsp?prg_no=flow_dynamic_rout.jsp");
    return;
  }

  QueryBean qbnDAO=new QueryBean(request.getParameter("DB_ALIAS"),Boolean.valueOf(request.getParameter("DEBUG")).booleanValue(), request.getParameter("SOURCE_CHARSET"), request.getParameter("TARGET_CHARSET") );

  com.pub.database.DataView DataView=new com.pub.database.DataView(qbnDAO);

  String lstrSQL=null;
  Hashtable<String,Hashtable<String,Object>> lhtTableData=null;

  //防止參數未存在
  String flow_num = request.getParameter("flow_num") == null ? "" : request.getParameter("flow_num").trim();
  flow_num = flow_num.equals("null") ? "" :flow_num;
  if (flow_num.equals("")){ out.println("<script>alert('【 參數錯誤 】無流程單號!');window.close();</script>");return;  }
  try{
    String flow_code=flow_num.substring(0,3);
    String table=qbnDAO.readSingleValueData("select master_table from flow_code where flow_code='"+flow_code+"'");
    table = table.equals("null") ? "" :table;
    if (table.equals("")){  out.println("<script>alert('【 參數錯誤 】flow_code中無設定流程主檔!');window.close();</script>");return;  }

    String count=qbnDAO.readSingleValueData("select count(*) from "+table+" where flow_num='"+flow_num+"'");
    if (count.equals("") || count.equals("null")|| count.equals("0")){  out.println("<script>alert('【 參數錯誤 】主檔中無此流程單號!');window.close();</script>");return;  }

    String flow_no=qbnDAO.readSingleValueData("select status from "+table+" where flow_num='"+flow_num+"'");
    String sempno = request.getSession().getAttribute("u_id").toString();
    String mode = request.getParameter("mode") == null ? "" : request.getParameter("mode").trim();
    String prgAction = request.getParameter("prgAction") == null ? "" : request.getParameter("prgAction").trim();
    String modify_empno = request.getParameter("modify_empno") == null ? "" : request.getParameter("modify_empno").trim();
    String modify_flowno = request.getParameter("modify_flowno") == null ? "" : request.getParameter("modify_flowno").trim();
    String now_flowno_seqno=qbnDAO.readSingleValueData("select seqno from floweng_setup where flow_code='"+flow_code+"' and flow_no='"+flow_no+"' and flow_use='1'");

    StringBuffer stbSQL = new   StringBuffer();
    StringBuffer stbSQLWhere = new StringBuffer();
    StringBuffer stbCondition = new StringBuffer();
    StringBuffer stbPageActionURI = new StringBuffer("flow_dynamic_rout.jsp?flow_num=");
    stbPageActionURI.append(flow_num);
    String onloadscript = null;


    //新增一筆data
    if(prgAction!=null && prgAction.equals("add"))
    {
      if (modify_flowno!=null && modify_empno!=null)
      {
        String add_seqno = qbnDAO.readSingleValueData("select max(to_number(seqno))+1 from flow_dynamic_rout where flow_num = '"+flow_num+"' and flow_no='"+modify_flowno+"' order by seqno desc");
        if (add_seqno==null || add_seqno.equals("null") || add_seqno.equals("") || add_seqno.equals("0")){add_seqno="1";}
        //判斷此人員是否已存在
        String cntEmpno=qbnDAO.readSingleValueData("select count(*) from (select employee_no from flow_dynamic_rout where flow_num = '"+flow_num+"' and flow_no='"+modify_flowno+"' and employee_no='"+modify_empno+"' union select r_empno from wkf_jst_eng where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' and r_empno='"+modify_empno+"' ) ");
        if (!qbnDAO.readSingleValueData("select count(*) from (select employee_no from flow_dynamic_rout where flow_num = '"+flow_num+"' and flow_no='"+modify_flowno+"' and employee_no='"+modify_empno+"' union select r_empno from wkf_jst_eng where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' and r_empno='"+modify_empno+"' ) ").equals("0") )
        {  out.println("<script>alert('【 新增失敗 】您所指定的會簽人員已存在或已在待處理名單中!');</script>"); }
        else
        {
          //1.塞人員到flow_dynamic_rout
          if (!qbnDAO.executeSQL("insert into flow_dynamic_rout(flow_code,flow_num,flow_no,employee_no,seqno,empno_app,app_date) values('"+flow_code+"','"+flow_num+"','"+modify_flowno+"','"+modify_empno+"','"+add_seqno+"','"+sempno+"',to_date('"+PublicFunction.getSYSDATE("yyyy/MM/dd HH:mm:ss")+"','yyyy/MM/dd hh24:mi:ss') )"))
          {out.println("<script>alert('【 新增失敗 】insert into flow_dynamic_rout error!');</script>");  }
          else
          {
            if (flow_no.equals(modify_flowno))//2.如果是同站別單站,要更新wkf_pre_jst/wkf_jst_eng
            {
              lstrSQL="select seqno,s_empno from wkf_jst_eng where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' order by seqno desc";
              lhtTableData=qbnDAO.hashtableSQL(lstrSQL);
              if (lhtTableData!=null && lhtTableData.size()>0 )
              {
                String seqno=((java.util.Hashtable<String,Object>)lhtTableData.get(String.valueOf(0))).get("SEQNO".toUpperCase()).toString();
                String s_empno=((java.util.Hashtable<String,Object>)lhtTableData.get(String.valueOf(0))).get("S_EMPNO".toUpperCase()).toString();

                //update wkf_pre_jst
                qbnDAO.executeSQL("update wkf_pre_jst set seqno=seqno+1 where pr_nbr='"+flow_num+"' and seqno>"+seqno);
                qbnDAO.executeSQL("insert into wkf_pre_jst (flow_type,pr_nbr,seqno,flow_no,rout_no,flow_use,pre_send) values ('"+flow_code+"','"+flow_num+"',"+(Integer.parseInt(seqno)+1)+",'"+modify_flowno+"',0,'1','"+modify_empno+"')");

                //update wkf_jst_eng
                String insJst="insert into wkf_jst_eng (flow_code,flow_num,s_empno,r_empno,msg_code,rec_date_time,jst_flag,notify_flag,flow_status,flow_no,seqno) ";
                insJst+="values('"+flow_code+"','"+flow_num+"','"+s_empno+"','"+modify_empno+"','"+modify_flowno+"',to_date('"+PublicFunction.getSYSDATE("yyyy/MM/dd HH:mm:ss")+"','yyyy/MM/dd hh24:mi:ss'),";
                insJst+="'N','0','"+flow_no+"','"+flow_no+"',"+(Integer.parseInt(seqno)+1)+")";
                qbnDAO.executeSQL(insJst);

              }
            }

            else
            {
              String pre_seqno=qbnDAO.readSingleValueData("select seqno from ( select seqno from wkf_pre_jst where pr_nbr='"+flow_num+"' and flow_no='"+modify_flowno+"' order by seqno desc ) where rownum=1");
              if (pre_seqno==null || pre_seqno.equals("") || pre_seqno.equals(null))
              {
                out.println("<script>alert('【 新增失敗 】無此站別預展資料!原因可能此流程單無須展到"+modify_flowno+"站');</script>");
                qbnDAO.executeSQL("delete from flow_dynamic_rout where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' and employee_no='"+modify_empno+"'");
              }
              else
              {
                //I站以外才可加wkf_pre_jst
                if (! (qbnDAO.readSingleValueData("select flow_type from floweng_setup where flow_code = '"+flow_code+"' and flow_no='"+modify_flowno+"' and flow_use='1'").equals("I")) )
                {
                  //update wkf_pre_jst
                  qbnDAO.executeSQL("update wkf_pre_jst set seqno=seqno+1 where pr_nbr='"+flow_num+"' and seqno>"+pre_seqno);
                  qbnDAO.executeSQL("insert into wkf_pre_jst (flow_type,pr_nbr,seqno,flow_no,rout_no,flow_use,pre_send) values ('"+flow_code+"','"+flow_num+"',"+(Integer.parseInt(pre_seqno)+1)+",'"+modify_flowno+"',0,'1','"+modify_empno+"')");
                }
              }
            }
          }
        }

      }
      prgAction=null;
    }

    //刪除一筆data
    if(prgAction!=null && prgAction.equals("del"))
    {
      if (modify_flowno!=null && modify_empno!=null && !modify_empno.equals(sempno))
      {
        if (!qbnDAO.readSingleValueData("select count(*) from wkf_jst_eng where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' and r_empno='"+modify_empno+"' and jst_flag='P' and rec_date_time is not null ").equals("0"))
        {  out.println("<script>alert('【 刪除失敗 】"+modify_empno+" 待處理已簽,無法刪除!');</script>"); }

        //如果是同站別單站,要更新wkf_pre_jst/wkf_jst_eng
        else if (flow_no.equals(modify_flowno))
        {
          if (qbnDAO.readSingleValueData("select count(*) from wkf_jst_eng where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' and jst_flag='N' and rec_date_time is not null ").equals("1"))
          {  out.println("<script>alert('【 刪除失敗 】此站別只有一位簽核者,若刪除將造成流程中斷!');</script>"); }
          else
          {
            String del_seqno=qbnDAO.readSingleValueData("select seqno from wkf_jst_eng where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' and r_empno='"+modify_empno+"'");
            //刪flow_dynamic_rout
            qbnDAO.executeSQL("delete from flow_dynamic_rout where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' and employee_no='"+modify_empno+"'");
            //update wkf_jst_eng
            qbnDAO.executeSQL("delete from wkf_jst_eng where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' and r_empno='"+modify_empno+"' and seqno="+del_seqno);
            qbnDAO.executeSQL("update wkf_jst_eng set seqno=seqno-1 where flow_num='"+flow_num+"' and seqno>"+del_seqno);
            qbnDAO.executeSQL("delete from wkf_pre_jst where pr_nbr='"+flow_num+"' and flow_no='"+modify_flowno+"' and seqno="+del_seqno);
            qbnDAO.executeSQL("update wkf_pre_jst set seqno=seqno-1 where pr_nbr='"+flow_num+"' and seqno>"+del_seqno);
          }
        }
        //非同站別
        else
        {
          String pre_seqno=qbnDAO.readSingleValueData("select seqno from ( select seqno from wkf_pre_jst where pr_nbr='"+flow_num+"' and flow_no='"+modify_flowno+"' order by seqno desc ) where rownum=1");
          if (pre_seqno==null || pre_seqno.equals("") || pre_seqno.equals(null))
          {out.println("<script>alert('【 刪除失敗 】無此站別預展資料!原因可能此流程單無須展到"+modify_flowno+"站');</script>");  }
          else
          {
            if (! (qbnDAO.readSingleValueData("select flow_type from floweng_setup where flow_code = '"+flow_code+"' and flow_no='"+modify_flowno+"' and flow_use='1'").equals("I")) )
            {
              //update wkf_pre_jst
              qbnDAO.executeSQL("delete from wkf_pre_jst where pr_nbr='"+flow_num+"' and flow_no='"+modify_flowno+"' and seqno="+pre_seqno);
              qbnDAO.executeSQL("update wkf_pre_jst set seqno=seqno-1 where pr_nbr='"+flow_num+"' and seqno>"+pre_seqno);
            }
            //刪flow_dynamic_rout
            qbnDAO.executeSQL("delete from flow_dynamic_rout where flow_num='"+flow_num+"' and flow_no='"+modify_flowno+"' and employee_no='"+modify_empno+"'");
          }
        }
      }
      else
      {  out.println("<script>alert('【 刪除失敗 】無法刪除自己的設定!');</script>"); }
      modify_empno=null;
      modify_flowno=null;
      prgAction=null;
    }//刪除資料

    DataViewForm.setFieldsList("'/PUBPAGE/images/star.gif',a.flow_no ||' '|| b.flow_desc,a.seqno,a.employee_no,a.employee_no||' '||(select employee_name_c from pnl_employee where a.employee_no=pnl_employee.employee_no(+)),a.empno_app ||' '|| (select employee_name_c from pnl_employee where a.empno_app=pnl_employee.employee_no(+)) ,to_char(a.app_date,'yyyy/MM/dd hh24:mi:ss'),a.flow_no,b.seqno as floweng_seqno,'delbtn',b.flow_type ");
    DataViewForm.setTablesList("flow_dynamic_rout a,floweng_setup b ");
    DataViewForm.setSQLCondition("a.flow_num='"+flow_num+"'  and a.flow_no=b.flow_no and a.flow_code=b.flow_code");
    DataViewForm.setOrderByFields("a.flow_no,a.seqno");
    DataViewForm.setOrderBySeq(null);
    DataViewForm.setGroupBy(null);
    DataViewForm.setHaving(null);

    boolean blnDebug = false;
    String strColRelation[][] = new String[12][];
    strColRelation[0] = new String[5];
    strColRelation[1] = new String[3];
    strColRelation[2] = new String[1];
    strColRelation[3] = new String[1];
    strColRelation[4] = new String[3];
    strColRelation[5] = new String[3];
    strColRelation[6] = new String[3];
    strColRelation[7] = new String[5];
    strColRelation[8] = new String[5];
    strColRelation[9] = new String[5];
    strColRelation[10] = new String[5];
    strColRelation[11] = new String[5];

    strColRelation[0][0]="''";
    strColRelation[0][1]="IMG";
    strColRelation[0][2]="WIDTH='5%'";
    strColRelation[0][3] = "<IMG name=\"star_%sn%\" SRC=";
    strColRelation[0][4] = "0"; //VALUE屬性的值(欄位序號)，若為固定值需以單引號括住

    strColRelation[1][0] = "'站別'";
    strColRelation[1][1] = "0";
    strColRelation[1][2] = "WIDTH='30%'";

    strColRelation[2][0] = "N";
    strColRelation[3][0] = "N";
/*
    strColRelation[3][0] = "'工號'";
    strColRelation[3][1] = "0";
    strColRelation[3][2] = "WIDTH='10%'";
*/
    strColRelation[4][0] = "'被加簽人'";
    strColRelation[4][1] = "0";
    strColRelation[4][2] =  "WIDTH='15%'";

    strColRelation[5][0] = "'設定人'";
    strColRelation[5][1] = "0";
    strColRelation[5][2] = "WIDTH='15%'";

    strColRelation[6][0] = "'設定時間'";
    strColRelation[6][1] = "0";
    strColRelation[6][2] =  "WIDTH='20%'";

    strColRelation[7][0] = "''";
    strColRelation[7][1] = "INPUT";
    strColRelation[7][2] =  "WIDTH='10%'";
    strColRelation[7][3] = "<INPUT TYPE=\"BUTTON\"  name=\"delBtn_%sn%\" style=\"DISPLAY='none'\" CLASS=\"button b_normal\" onclick=\"javascript:delBtn('%sn%')\" value=";
    strColRelation[7][4] = "'刪除'";

    strColRelation[8][0] = "HIDDEN";
    strColRelation[8][1] = "INPUT";
    strColRelation[8][2] = "nowrap";
    strColRelation[8][3] = "<INPUT TYPE=\"hidden\" name=\"emp_%sn%\"  VALUE=";
    strColRelation[8][4] = "3";

    strColRelation[9][0] = "HIDDEN";
    strColRelation[9][1] = "INPUT";
    strColRelation[9][2] = "nowrap";
    strColRelation[9][3] = "<INPUT TYPE=\"hidden\" name=\"flowno_%sn%\"  VALUE=";
    strColRelation[9][4] = "7";

    strColRelation[10][0] = "HIDDEN";
    strColRelation[10][1] = "INPUT";
    strColRelation[10][2] = "nowrap";
    strColRelation[10][3] = "<INPUT TYPE=\"hidden\" name=\"flowseqno_%sn%\"  VALUE=";
    strColRelation[10][4] = "8";

    strColRelation[11][0] = "HIDDEN";
    strColRelation[11][1] = "INPUT";
    strColRelation[11][2] = "nowrap";
    strColRelation[11][3] = "<INPUT TYPE=\"hidden\" name=\"flowtype_%sn%\"  VALUE=";
    strColRelation[11][4] = "10";



    DataViewForm.setColRelation(strColRelation);//將欄位相關設定殖入ActionForm
    DataViewForm.setJumpPageButtonShow(false);   //是否要秀出上下頁按鈕
    DataViewForm.setPageBtnOnTop(false);         //將button and rows info 秀在頂端
    DataViewForm.setPageBtnOnButtom(true);      //將button and rows info 秀在底端
    DataViewForm.setFilterShow(false);           //是否要秀出過濾選擇欄位
    DataViewForm.setJumpPageShow(false);         //是否要秀出跳頁下拉式選單
    DataViewForm.setRowsInfoShow(false);         //是否要秀出筆數資訊
    DataViewForm.setRowPageShow(false);          //是否要秀出每頁筆數控制欄
    DataViewForm.setExcelShow(false);           //是否要秀出轉Excel button
    DataViewForm.setOrderEnable(false);          //是否要提供排序點選功能
    DataViewForm.setShowHeaderWhenNoData(false);//當DataView無資料時是否要秀Header

    DataViewForm.setTableHeaderHtml("class='td_head_grid' align='center'");
    //設定上一頁與下一頁按鈕的form action(通常為母頁即本頁)
    DataViewForm.setPageActionURI(stbPageActionURI.toString());

  //設定頁面控制按鈕出現的位置
  // DataViewForm.setPageRowCount(10);
  //00--都不顯示
  //01--顯示於下方
  //10--顯示於上方
  //11--上下都顯示
  //設定上一頁與下一頁按鈕的form action(通常為母頁即本頁)

%>
  <html>
  <head>
  <title>動態加簽</title>
  <LINK HREF="/PUBPAGE/general/workflow.css" REL="STYLESHEET" TYPE="TEXT/CSS">
    <script language="javascript" type="">
    function delBtn(varSn){
      if(confirm("是否要刪除此筆資料?")){
        document.all.item('prgAction').value='del';
        document.all.item('modify_empno').value=document.all.item('emp_'+varSn).value;
        document.all.item('modify_flowno').value=document.all.item('flowno_'+varSn).value;
        document.forms[0].submit();
        }
      }

    function getEmpData(){
      ret=window.showModalDialog("find_employee.jsp?DB_ALIAS=<%=qbnDAO.getDBAlias() %>&DEBUG=<%=qbnDAO.getDBDebugMode()%>&SOURCE_CHARSET=<%=qbnDAO.getSourceCharset()%>&TARGET_CHARSET=<%=qbnDAO.getTargetCharset() %>","_blank");
      if(ret==null){return;}
      val=ret.split(',');
      document.all.item("modify_empno").value=val[0];//empno
    }
    //開窗置中
 function init()
 {
  window.moveTo((screen.width-document.body.clientWidth)/2-5,(screen.height-document.body.clientHeight)/2-60);
}
    </script>

    <base target='_self'/>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
<!--
body {
	margin-left: 5px;
	margin-top: 5px;
	margin-right: 5px;
	margin-bottom: 5px;
}
-->
</style></head>
  <body onLoad="init();">
  <TABLE BORDER="0" HEIGHT="20" CELLPADDING="0" CELLSPACING="0">
    <TR>
      <TD  BACKGROUND="/PUBPAGE/pub_images/title/title_bg.gif"><DIV ALIGN="LEFT"><IMG SRC="/PUBPAGE/pub_images/title/title01.gif" WIDTH="18" HEIGHT="24" HSPACE="0" alt=""/><IMG SRC="/PUBPAGE/pub_images/glass.gif" WIDTH="12" HEIGHT="8" alt=""/></DIV></TD>
      <TD ALIGN="LEFT" HEIGHT="20" VALIGN="MIDDLE" BACKGROUND="/PUBPAGE/pub_images/title/title_bg.gif" CLASS="TITLE">動態加簽</TD>
      <TD BACKGROUND="/PUBPAGE/pub_images/title/title_bg.gif"><DIV ALIGN="RIGHT"><IMG SRC="/PUBPAGE/pub_images/glass.gif" WIDTH="12" HEIGHT="8" alt=""/><IMG SRC="/PUBPAGE/pub_images/title/title02.gif" WIDTH="18" HEIGHT="24" HSPACE="0" alt=""/></DIV></TD>
    </TR>
  </TABLE>
  <form name="form1" method="post" action="">
  <table width="500" border="0">
    <tr>
      <td colspan="4" >動態加簽規則：<br>
        1.須為群組會簽及全部簽核的站別<br>
        2:已結案流程無法設定加簽</td>
    </tr>
    <tr>
      <td width="75" class="text_mark" >流程單號：</td>
      <td width="85" class="text_mark"><%=flow_num %></td>
      <td width="75" class="text_mark" >目前站別：</td>
      <td width="117" class="text_mark"><%=flow_no %></td>
    </tr>
  </table>
  <table width="450" border="0">
    <tr>
      <td class="td_head">可加簽站別</td>
      <td><select name="modify_flowno" class="select">
        <option value=""></option>
        <%
        java.util.Hashtable<String,Hashtable<String,Object>> flownoData=null;
        String flownoData_sql="select flow_no,flow_desc from floweng_setup where flow_code='"+flow_code+"'";
        flownoData_sql+=" and flow_use='1' and seqno >= (select seqno from floweng_setup where flow_code='"+flow_code+"' and flow_no='"+flow_no+"' and flow_use='1')";
        flownoData_sql+=" and flow_type in ('D','I','J') and flow_send_num='0'";
        flownoData=qbnDAO.hashtableSQL(flownoData_sql);
        if (flownoData!=null&& flownoData.size() >0)
        {  for(int i=0;i<flownoData.size();i++)
        {
          %>
          <option value="<%=(((java.util.Hashtable<String,Object>)flownoData.get(String.valueOf(i))).get("flow_no".toUpperCase())!=null ? ((java.util.Hashtable<String,Object>)flownoData.get(String.valueOf(i))).get("flow_no".toUpperCase()).toString() : " ")%>"> <%=(((java.util.Hashtable<String,Object>)flownoData.get(String.valueOf(i))).get("flow_no".toUpperCase())!=null ? ((java.util.Hashtable<String,Object>)flownoData.get(String.valueOf(i))).get("flow_no".toUpperCase()).toString() : " ")%> <%=(((java.util.Hashtable<String,Object>)flownoData.get(String.valueOf(i))).get("flow_desc".toUpperCase())!=null ? ((java.util.Hashtable<String,Object>)flownoData.get(String.valueOf(i))).get("flow_desc".toUpperCase()).toString() : " ")%> </option>
          <%}} %></select>
          (只能設定目前站別之後的選項)</td>
    </tr>
    <tr>
      <td width="86" class="td_head">加簽人員</td>
      <td width="363">
        <acronym title="雙擊滑鼠開窗點選工號">
        <input name="modify_empno" type="text" SIZE="5,10" MAXLENGTH="8"  class="input_window hand" onDblClick="getEmpData()" onKeyDown="this.blur();">
        </acronym>
      </td>
    </tr>

    <tr>
      <td colspan="2">
        <input name="addBtn" type="button" CLASS="button b_normal" onClick="javascript:document.all.item('prgAction').value='add';document.forms[0].submit();" value="新增">
        <input name="reset" type="reset" CLASS="button b_normal" value="重設">
        <input name="exitBtn" type="button" CLASS="button b_normal" id="exitBtn" onClick="window.close();" value="離開">
        <input type="hidden" name="prgAction" value="<%=prgAction%>"/>
        <input name="table" type="hidden"  value="<%=table%>">
        <input name="mode" type="hidden"  value="<%=mode%>">
        <input name="flow_no" type="hidden"  value="<%=flow_no%>">
      </td>
    </tr>
  </table>
  <table width="550" border="0">
    <tr>
      <td width="361"><font CLASS="text_head">&nbsp; </font>
        <TABLE HEIGHT="20" BORDER="0" CELLSPACING="0" CELLPADDING="0" >
          <TR>
            <TD WIDTH="69"><DIV ALIGN="LEFT"><IMG SRC="/PUBPAGE/pub_images/title/title02_bg1.gif" WIDTH="69" HEIGHT="11"></DIV></TD>
              <TD ID="frm_name2_id" VALIGN="MIDDLE" CLASS="TITLE">流程加簽人員</TD>
              <TD WIDTH="69"><DIV ALIGN="RIGHT"><IMG SRC="/PUBPAGE/pub_images/title/title2_bg2.gif" WIDTH="69" HEIGHT="11"></DIV></TD>
          </TR>
        </TABLE>
      </td>
    </tr>
    <tr>
      <td>
      <% DataView.OutputDataView(DataViewForm, pageContext); %>
      <script type="">
      //控制各站別上傳按鈕的顯示
      for(i=0;i<<%=DataViewForm.getReadDataSize()%>;i++)
      {
        var mode="<%=mode%>";

        //del button
        if( document.all.item("flowseqno_" + i).value>=<%=now_flowno_seqno%>  )
        { document.getElementById("delBtn_"+i).style.display="";   }

        //星號顯示控制
        if(document.all.item('flowtype_' + i).value!=='I')
        {document.all.item('star_' + i).style.display="none";}
        else{ document.all.item('star_' + i).style.display="";}
      }

 </script><font class="ps">PS:<img src="/PUBPAGE/pub_images/star.gif" />表示此站為動態簽核站別,流程至該站,待處理才會展開</font>
      </td>
    </tr>
  </table>
  </form>
  </body>
  </html>
  <%

  }//try
  catch(Exception e){
    e.printStackTrace();
  }
  finally{
    try{qbnDAO.close();}catch(Exception e){System.out.println("can not close querybean in action.java");}
    qbnDAO=null;
  }
  %>
